<template>
  <div>
    <!-- 三级分类导航 -->
    <TypeNav />

    <!-- 轮播+右分类 -->
    <ListContainer />

    <!-- 今日推荐 -->
    <Recommend />

    <!-- 商品排行 -->
    <Rank />

    <!-- 猜你喜欢 -->
    <Like />

    <!-- 楼层，即：家用电器、手机通讯 -->
    <Floor v-for="item in floorList" :key="item.id" :floor="item" />

    <!-- 商标区 -->
    <Brand />
  </div>
</template>

<script>
// 导入辅助函数
import { mapState } from 'vuex'

// import TypeNav from './TypeNav'
import Brand from './Brand'
import Floor from './Floor'
import Like from './Like'
import ListContainer from './ListContainer'
import Rank from './Rank'
import Recommend from './Recommend'

export default {
  name: 'SphIndex',
  components: {
    // TypeNav,
    Brand,
    Floor,
    Like,
    ListContainer,
    Rank,
    Recommend
  },
  created() {
    // 使用实例来调用 模块中的获取楼层数据方法
    this.$store.dispatch('home/getFloorData')
  },
  computed: {
    ...mapState('home', ['floorList'])
  }
}
</script>

<style scoped></style>
